﻿
Imports std

Public Class stringsPackage
    Inherits commonStringsPackage

    Public Overrides Function strings() As strings
        Return at(httpServer2.currentContext())
    End Function

    'leave them here, this is only for http servers
    Public Overloads Function strings(ByVal request As Net.HttpListenerRequest) As strings
        If request Is Nothing Then
            Return strings(defaultLanguage)
        Else
            Return strings(httpUtils.language(request))
        End If
    End Function

    Public Overloads Function strings(ByVal context As Net.HttpListenerContext) As strings
        If context Is Nothing Then
            Return strings(defaultLanguage)
        Else
            Return strings(context.Request)
        End If
    End Function

    Default Public ReadOnly Property at(ByVal context As httpContext) As strings
        Get
            If context Is Nothing Then
                Return strings(defaultLanguage)
            Else
                'some overrides in httpContext, so directly use language()
                Return strings(context.language())
            End If
        End Get
    End Property
End Class
